package com.chinadci.smartcommunitysystembackstage.mapper;

import com.chinadci.smartcommunitysystembackstage.entity.ScsAdmin;
import com.chinadci.smartcommunitysystembackstage.entity.ScsAdmintype;
import com.chinadci.smartcommunitysystembackstage.entity.ScsForum;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinadci.smartcommunitysystembackstage.entity.ScsUser;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Code Duck
 * @since 2021-04-13
 */
public interface ScsForumMapper extends BaseMapper<ScsForum> {
    //显示所有朋友圈
    @Select("select * from scs_forum")
    @Results({
            @Result(id=true,column = "f_id",property = "fId"),
            @Result(column = "f_info",property = "fInfo"),
            @Result(column = "f_create_time",property = "fCreateTime"),
            @Result(column = "f_img",property = "fImg"),
            @Result(column = "u_id",property = "user",many = @Many(select = "Select")),
    })
    List<ScsForum> Find();

    @Select("select * from scs_user where u_id=#{u_id}")
    List<ScsUser> Select();

    //根据id查找朋友圈
    @Select("select * from scs_forum where u_id=#{id}")
    @Results({
            @Result(id=true,column = "f_id",property = "fId"),
            @Result(column = "f_info",property = "fInfo"),
            @Result(column = "f_create_time",property = "fCreateTime"),
            @Result(column = "f_img",property = "fImg"),
            @Result(column = "u_id",property = "user",many = @Many(select = "Select")),
    })
    List<ScsForum> Finds(int id);
}
